/*
 * @Author: wpp 906008377@qq.com
 * @Date: 2025-04-01 15:45:45
 * @LastEditors: wpp 906008377@qq.com
 * @LastEditTime: 2025-04-01 16:50:25
 * @FilePath: \vue-project\src\views\component\HPage.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import './index.scss'
import { h, ref, defineComponent } from 'vue'
import { ElButton } from 'element-plus'

export default defineComponent({
  name: 'HPage',
  props: {
    test: {
      type: String,
      default: 'test'
    }
  },
  emits: ['testEmit'],
  setup(props, context) {
    const count = ref(0)
    // return () =>
    //   h('div', [
    //     h('div', count.value),
    //     h(
    //       ElButton,
    //       {
    //         onClick: () => count.value++
    //       },
    //       '加加'
    //     )
    //   ])

    const testFn = () => {
      console.log(context)
      context.emit('testEmit', '测试Emit')
    }

    return () => {
      return (
        <div class="h-page">
          <div class="text">{props.test}</div>
          <div>{count.value}</div>
          {/* 插槽测试 */}
          {context.slots.default?.()}
          <div>
            <ElButton onClick={() => count.value++}>加加</ElButton>
            <ElButton onClick={testFn}>test按钮</ElButton>
          </div>
        </div>
      )
    }
  }
})
